package han.chensing.latos.game.elements.logic;

import com.badlogic.gdx.math.Vector2;

public class Speed {
    protected Vector2 speed;
    protected Speed acceleration;

    public Speed(){
        this.speed=new Vector2();
    }

    public Vector2 updateSpeed(float deltaTime){
        if (acceleration==null)
            return speed;
        Vector2 vector2 = acceleration.updateSpeed(deltaTime);
        if (vector2==null)
            return speed;
        Vector2 cpy = vector2.cpy();
        return speed.add(cpy.scl(deltaTime));
    }

    public Vector2 getSpeed() {
        return speed;
    }

    public Speed setSpeed(Vector2 speed) {
        this.speed = speed;
        return this;
    }

    public Speed getAcceleration() {
        return acceleration;
    }

    public void setAcceleration(Speed acceleration) {
        this.acceleration = acceleration;
    }
}
